package Test;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * Created by Administrator on 2017/5/20.
 */
public class ceshi {
    public static void main(String[] args) throws Exception {
        String s="";
        File file = new File("D:\\xsh136\\src\\cc.txt");

        FileOutputStream fos = new FileOutputStream(file);
        FileInputStream fis1 = new FileInputStream(new File("D:\\xsh136\\src\\aa.txt"));
        FileInputStream fis2 = new FileInputStream(new File("D:\\xsh136\\src\\bb.txt"));
        byte[] b = new byte[1024];
        while((fis1.read(b)) != -1) {
            s += new String(b);
            //将文本中的内容写到另一个文本中
            fos.write(b);
        }
        while((fis2.read(b)) != -1) {
            s+=new String(b);
            fos.write(b);
        }
        fos.flush();
        System.out.println("合并成功!");



    }
}
